{{define "system/notice/edit"}}
  {{template "layout_form" .}}
{{end}}
{{define "js_common"}}
  {{block "summernote" .}}{{end}}
{{end}}
{{define "content"}}
<form class="form-horizontal m" id="form-edit">
  <input type="hidden" name="id" value="{{.info.Id}}">
  <div class="form-group">
    <label class="col-sm-2 control-label is-required">标题：</label>
    <div class="col-sm-9">
      <input type="text" name="title" value="{{.info.Title}}" class="form-control" placeholder="请输入标题" required autocomplete="off"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label is-required">类型：</label>
    <div class="col-sm-9">
        {{ range $index,$item := .typeList}}
        <label class="radio-box"><input type="radio" name="type" value="{{$item.Key}}" required {{if eq $.info.Type $item.Key}} checked {{end}}/>{{$item.Value}}</label>
        {{end}}
    </div>
  </div>

  <div class="form-group">
    <label class="col-sm-2 control-label is-required">内容：</label>
    <div class="col-sm-9">
      <textarea id="content" name="content" class="summernote_content hide" required>{{.info.Content}}</textarea>
      <div class="summernote" data-place="请输入内容" id="contentEditor"></div>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label is-required">状态：</label>
    <div class="col-sm-9">
      <label class="radio-box"><input type="radio" name="status" value="0" {{if eq $.info.Status "0"}} checked {{end}}/> 无效</label>
      <label class="radio-box"><input type="radio" name="status" value="1" {{if eq $.info.Status "1"}} checked {{end}}/> 有效</label>
    </div>
  </div>
</form>
{{end}}
{{define "script"}}
<script>
  function submitHandler() {
    if ($.validate.form()) {
      if($("#contentEditor").summernote('isEmpty')){
        $.modal.msgError('请填写内容')
        return false;
      }
      $("#content").val($('#contentEditor').summernote('code'));
      $.operate.save(window.b5go.oesUrl, $('#form-edit').serialize());
    }
  }
</script>
{{end}}


